import { App } from "vue";
import axios from "axios";
import VueAxios from "vue-axios"

const server = axios.create({
    baseURL: "/api",
    timeout: 6000
});

server.interceptors.request.use(config => {
    return config
},error => {
    return Promise.reject(error)
})

server.interceptors.response.use(response=>{
    return response.data
},error=>{
    return Promise.reject(error)
})

var installer = {
    install(app: App<Element>) {
        app.use(VueAxios, server)
    }
}

export {
    installer as VueAxios,
    server as axios
}